package com.pxst.merchant.controller;

import com.pxst.annotations.LogOperate;
import com.pxst.merchant.entity.SysMerchantAdjust;
import com.pxst.merchant.req.MonthlyCreatReq;
import com.pxst.merchant.req.MonthlyReq;
import com.pxst.merchant.resp.MonthlyResp;
import com.pxst.merchant.service.SysMerchantAdjustService;
import com.pxst.resp.ApiResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
* @author zarke
* @since 2023-09-14 09:58:11
*/
@RestController
@RequestMapping("/api/adjust")
@Api(tags = "每月调整")
public class SysMerchantAdjustController {

    @Autowired
    private SysMerchantAdjustService sysMerchantAdjustService;

    @GetMapping
    @ApiOperation(value = "搜索")
    public ApiResp<MonthlyResp> getAdjust(MonthlyReq monthlyReq) {
        return sysMerchantAdjustService.getAdjust(monthlyReq);
    }

    @PostMapping
    @ApiOperation(value = "新增调整")
    @LogOperate(operate = "新增调整", service = SysMerchantAdjustService.class, type = "add")
    @PreAuthorize("@ss.hasAnyPermissions('merchant:adjust:create')")
    public ApiResp<SysMerchantAdjust> create(@RequestBody MonthlyCreatReq monthlyCreatReq) {
        return sysMerchantAdjustService.create(monthlyCreatReq);
    }
}
